From 49136c3898fc71c4d9e9a8c93bb59b4c601b1eec Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 6 Sep 2018 16:18:31 +0100 Subject: [PATCH] x86: XENMEM_resource_ioreq_server is HVM only Put the entire case branch under CONFIG_HVM. Lift the check from hvm_get_ioreq_server_frame into its caller. Signed-off-by: Wei Liu Reviewed-by: Paul Durrant Reviewed-by: Jan Beulich --- xen/arch/x86/hvm/ioreq.c | 3 +-- xen/arch/x86/mm.c | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c index b3e1a3a36f..3569beaad5 100644 --- a/xen/arch/x86/hvm/ioreq.c +++ b/xen/arch/x86/hvm/ioreq.c @@ -898,8 +898,7 @@ int hvm_get_ioreq_server_frame(struct domain *d, ioservid_t id, struct hvm_ioreq_server *s; int rc; - if ( !is_hvm_domain(d) ) - return -EINVAL; + ASSERT(is_hvm_domain(d)); spin_lock_recursive(&d->arch.hvm.ioreq_server.lock); diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 409814ce0a..baea2f5e63 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4381,12 +4381,16 @@ int arch_acquire_resource(struct domain *d, unsigned int type, switch ( type ) { +#ifdef CONFIG_HVM case XENMEM_resource_ioreq_server: { ioservid_t ioservid = id; unsigned int i; rc = -EINVAL; + if ( !is_hvm_domain(d) ) + break; + if ( id != (unsigned int)ioservid ) break; @@ -4409,6 +4413,7 @@ int arch_acquire_resource(struct domain *d, unsigned int type, *flags |= XENMEM_rsrc_acq_caller_owned; break; } +#endif default: rc = -EOPNOTSUPP; -- 2.30.2